package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import model.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import service.UserService;
import action.base.BaseAction;

@Controller
@Scope("prototype")
public class LoginAction extends BaseAction {
	/**
	 * 
	 */
	@Autowired
	private UserService userService;
	private static final long serialVersionUID = -7814501144354538162L;
	private Boolean success = false;

	/**
	 * 登录验证
	 * 
	 * @return
	 */
	public String login(HttpServletRequest request) {
		HttpSession session = request.getSession(false);
		User user = super.getUser();
		String uif=user.getUsername()+"("+user.getName()+")";
		session.setAttribute("user", uif);
//		session.setAttribute("randCode", null);
		System.out.print(" 系统测试");
		System.out.print(" /n");
		setSuccess(true);
		return "success";
		
	}

	public String getSysUser() {
		setSuccess(true);
		return SUCCESS;
	}

	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

}
